package tasks.OpportunitiesBaseData.MainView;
import java.util.ArrayList;

import resources.tasks.OpportunitiesBaseData.MainView.STGFrontEndWrapperHelper;
import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.SAP.*;
import com.rational.test.ft.object.interfaces.WPF.*;
import com.rational.test.ft.object.interfaces.dojo.*;
import com.rational.test.ft.object.interfaces.siebel.*;
import com.rational.test.ft.object.interfaces.flex.*;
import com.rational.test.ft.object.interfaces.generichtmlsubdomain.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import com.ibm.rational.test.ft.object.interfaces.sapwebportal.*;

import core.Configurations;
import core.ControlsMapping;
import core.exceptions.ResultFailureException;
/**
 * Description   : Functional Test Script
 * @author angel.tsvetkov
 */
public class STGFrontEndWrapper extends STGFrontEndWrapperHelper
{
	/**
	 * Script Name   : <b>FrontEndWrapper</b>
	 * Generated     : <b>Nov 24, 2011 1:39:41 PM</b>
	 * Description   : Functional Test Script
	 * Original Host : WinNT Version 6.1  Build 7601 (S)
	 * 
	 * @since  2011/11/24
	 * @author angel.tsvetkov
	 */
	public ArrayList<STGLayout> get()
	{
		return get(null);
	}
	
	public ArrayList<STGLayout> get(String detailNumber)
	{
		int rowNumber = 0;
		ArrayList<STGLayout> layout = new ArrayList<STGLayout>();
		
		try {
			String[][] frontEndContent = ControlsMapping.MainView.mainView_table.transformTable();

			for(String[] row:frontEndContent)
			{
				if(rowNumber == 0)
				{
					rowNumber++;
					continue;
				}
				
				if(detailNumber != null)
				{
					if(!row[12].equals(detailNumber))
					{
						rowNumber++;
						continue;
					}
				}
				STGLayout tmpLayout = new STGLayout();
				
				tmpLayout.setRepInput(row[STGColumns.RepInput.ordinal()]);

				tmpLayout.setGeo(row[STGColumns.Geo.ordinal()]);

				tmpLayout.setImt(row[STGColumns.IMT.ordinal()]);

				tmpLayout.setSeller(row[STGColumns.Seller.ordinal()]);

				tmpLayout.setInsideSalesInv(row[STGColumns.InsideSalesInv.ordinal()]);

				tmpLayout.setOwner(row[STGColumns.Owner.ordinal()]);

				tmpLayout.setQtrInd(row[STGColumns.QtrInd.ordinal()]);

				tmpLayout.setDecWkorFcstWk(row[STGColumns.DecWkorFcstWk.ordinal()]);

				tmpLayout.setFcstDate(row[STGColumns.FcstDate.ordinal()]);

				tmpLayout.setSubbrand(row[STGColumns.Subbrand.ordinal()]);

				tmpLayout.setProdlvl30(row[STGColumns.ProdLvl30.ordinal()]);

				tmpLayout.setOppNo(row[STGColumns.OppNo.ordinal()]);

				tmpLayout.setDtlKey(row[STGColumns.DtlKey.ordinal()]);

				tmpLayout.setCustName(row[STGColumns.CustName.ordinal()]);

				tmpLayout.setCustNo(row[STGColumns.CustNo.ordinal()]);

				tmpLayout.setOwnOrg(row[STGColumns.OwnOrg.ordinal()]);

				tmpLayout.setOppSource(row[STGColumns.OppSource.ordinal()]);

				tmpLayout.setOppName(row[STGColumns.OppName.ordinal()]);

				tmpLayout.setSsCode(row[STGColumns.SSCode.ordinal()]);

				tmpLayout.setSsName(row[STGColumns.SSName.ordinal()]);

				tmpLayout.setDtlOdds(row[STGColumns.DtlOdds.ordinal()]);

				tmpLayout.setDtlRev(row[STGColumns.DtlRev.ordinal()]);

				tmpLayout.setPrismRev(row[STGColumns.PrismRev.ordinal()]);

				tmpLayout.setIbssRev(row[STGColumns.IBSSRev.ordinal()]);

				tmpLayout.setOppRole(row[STGColumns.OppRole.ordinal()]);

				tmpLayout.setSiebelPVStatus(row[STGColumns.SiebelPVStatus.ordinal()]);

				tmpLayout.setPrismPVStatus(row[STGColumns.PRISMPVStatus.ordinal()]);

				System.out.println("Data for " + tmpLayout.getDtlKey() + " detail was wrapped!");
				
				layout.add(tmpLayout);
				
				rowNumber++;
			}
		} catch (ResultFailureException e) {
			e.printStackTrace();
		}
		
		return layout;
	}
}

